package com.arofoxmsn.services.msj;

import java.util.Calendar;

import com.arofoxmsn.model.User;
import com.arofoxmsn.model.location.UserLocation;
import com.arofoxmsn.model.message.Message;
import com.arofoxmsn.utils.FlashMessage;
import com.arofoxmsn.utils.ParametersTool;

public class MessageSenderService {
	
	/**
	 * this method is in charge of loading a message into data base.
	 * It is a call to a web services and it returns.
	 * @param message
	 * @return
	 */
	public static FlashMessage send(Message message){
		FlashMessage flashToReturn = new FlashMessage();
		if(ParametersTool.testNullObjectBoolean(message)){
			//Here it comes the savi into data base
			flashToReturn.setData(FlashMessage.Type.OK, "Message will be sent");
		}else{
			flashToReturn.setData(FlashMessage.Type.ERROR, "Message can't be null");
		}
		return flashToReturn;
	}
	
	public FlashMessage send(String subject, String message,
			long parentId, long userFromId, long userToId, int state,
			long createdAtLong, double latitud, double longitud) {
		
		User userFrom = new User(); //get from data base
		User userTo = new User(); //get from data base
		Calendar createdAt = Calendar.getInstance();
		createdAt.setTimeInMillis(createdAtLong);
		Message parentMessage = new Message(); //get from data base
		
		UserLocation location = new UserLocation();
		location.setUserLocation(latitud,longitud);
		
		return new FlashMessage();
	}
}
